﻿<%@ Page Title="Strategic Asset Management Las Vegas: Graphs" Language="C#" MasterPageFile="~/Site2.master"
    AutoEventWireup="true" CodeBehind="Dashboard.aspx.cs" Inherits="LenderClearingHouse.Dashboard"
    ValidateRequest="false" EnableViewState="true" %>

<%@ Register TagPrefix="dcwc" Namespace="Dundas.Charting.WebControl" Assembly="DundasWebChart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI, Version=2012.1.411.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.1.7.1213, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<asp:Content ID="Content3" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function btnPrint_Click()
        {
            var chart = GetChart();
            if (chart != null)
            {
                var printWindow = window.open('', 'Print Window', 'height=900,width=1000');
                printWindow.document.write('<html><head><title>Print Window</title>');
                printWindow.document.write('</head><body ><img src=\'');
                printWindow.document.write(chart.src);
                printWindow.document.write('\' /></body></html>');
                printWindow.document.close();
                printWindow.print();
            }
            return false;
        }

        function GetChart()
        {
            var arr = document.getElementsByTagName('img');
            var chart = null;
            for (var i = 0; i < arr.length; i++)
            {
                if (arr[i].id.indexOf('Chart1') >= 0)
                {
                    chart = arr[i];
                    break;
                }
            }
            return chart;
        }

    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cphPageHeader" runat="server">
    Estimate vs Actual
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server">
    <asp:UpdatePanel ID="upd" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <table width="100%">
                <tr>
                    <td>
                        <asp:DataPager ID="pagerTop" runat="server" PagedControlID="lvFake">
                            <Fields>
                                <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False"
                                    FirstPageText="<<" PreviousPageText="<" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False"
                                    NextPageText=">" LastPageText=">>" />
                            </Fields>
                        </asp:DataPager>
                        </td>
                        <td>
                            <asp:Label ID="lbIvestor" runat="server" Text="Investor"></asp:Label>&nbsp;
                            <telerik:RadComboBox ID="cbInvestor" runat="server" Width="150" EmptyMessage="Type a Investor Name"
                            AllowCustomText="false" MarkFirstMatch="true" AutoPostBack="true" DataSourceID="SqlDataSourceInvestorCombo"
                            DataTextField="UserName" DataValueField="UserId" 
                            onselectedindexchanged="cbInvestor_SelectedIndexChanged">
                            </telerik:RadComboBox>
                            <asp:SqlDataSource ID="SqlDataSourceInvestorCombo" runat="server"
                            ConnectionString="<%$ ConnectionStrings:SQLConnection %>"
                            SelectCommand="getInvestorsCombo" SelectCommandType="StoredProcedure" />
                        </td>
                        
                        <td>
                            <asp:CalendarExtender ID="CalendarFromDate" runat="server" TargetControlID="txtFromDate" PopupButtonID="btnFromDate" Format="MM.dd.yyyy">
                            </asp:CalendarExtender>
                            <asp:MaskedEditExtender ID="meeFromDate" runat="server" TargetControlID="txtFromDate" CultureName="en-US" Mask="99.99.9999" clearmaskonlostfocus="false" MaskType="None"></asp:MaskedEditExtender>
                            <asp:TextBox ID="txtFromDate" Format="dd.MM.yyyy" TodaysDateFormat="dd.MM.yyyy" runat="server" width="80px" ></asp:Textbox>
                            <asp:Image ID="btnFromDate" runat="server" Style="vertical-align: middle; cursor: pointer;"
                            AlternateText="Choose Date"  ImageUrl="~/images/Calendar_icon.png" Width="16" Height="16" />
                            <span> - </span>
                            <asp:CalendarExtender ID="CalendarToDate" runat="server" TargetControlID="txtToDate" PopupButtonID="btnToDate" Format="MM.dd.yyyy">
                            </asp:CalendarExtender>
                            <asp:MaskedEditExtender ID="meeToDate" runat="server" TargetControlID="txtToDate" CultureName="en-US" Mask="99.99.9999" clearmaskonlostfocus="false" MaskType="None"></asp:MaskedEditExtender>
                            <asp:TextBox ID="txtToDate" Format="dd.MM.yyyy" TodaysDateFormat="dd.MM.yyyy" runat="server" width="80px" ></asp:Textbox>
                            <asp:Image ID="btnToDate" runat="server" Style="vertical-align: middle; cursor: pointer;"
                            AlternateText="Choose Date"  ImageUrl="~/images/Calendar_icon.png" Width="16" Height="16" />  &nbsp;
                            <asp:Button id="reloadButton" runat="server" Text="Show" OnClick="calendarDate_Changed" />  
                        </td>
                        
                        <td>
                            <div id="divPrint" >
                             <input type="image" id="btnToPrinter" title="Print current Chart" src="images/printer.png" value="Print" 
                             onclick="return btnPrint_Click();"  />
                             </div>
                        </td>

                        <td>
                            <asp:Panel ID="pnlABC1" Style="float: right;" runat="server"></asp:Panel>
                        </td>
                        

                </tr>
                <tr>
              <td></td><td></td>
              <td>
                 <asp:Label ID ="lblDataValidate" style = "display: none; color: red" runat="server"></asp:Label>
              </td> 
          </tr>
            </table>
            <dcwc:Chart ID="Chart1" ClientIDMode="Static" runat="server" Height="800px" Width="1160px" Palette="Pastel">
                <Series>
                    <dcwc:Series Name="Estimated resale" BorderColor="Black" ShadowOffset="2">
                    </dcwc:Series>
                    <dcwc:Series Name="Actual resale" BorderColor="Black" ShadowOffset="2">
                    </dcwc:Series>
                    <dcwc:Series Name="Estimated rehab" BorderColor="Black" ShadowOffset="2">
                    </dcwc:Series>
                    <dcwc:Series Name="Actual rehab" BorderColor="Black" ShadowOffset="2">
                    </dcwc:Series>
                </Series>
                <ChartAreas>
                    <dcwc:ChartArea Name="Default">
                    </dcwc:ChartArea>
                </ChartAreas>
            </dcwc:Chart>
            <asp:ListView ID="lvFake" runat="server" OnPagePropertiesChanging="lvFake_PagePropertiesChanging"
                Visible="false">
                <LayoutTemplate>
                    <ul>
                        <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
                    </ul>
                </LayoutTemplate>
                <ItemTemplate>
                    <li>
                        <%# Eval("PropertyLocation")%>
                    </li>
                </ItemTemplate>
                <EmptyDataTemplate>
                    No data
                </EmptyDataTemplate>
            </asp:ListView>
            
            <asp:Panel ID="pnlNoItems" Visible="false" CssClass="centeredDiv" runat="server">
                <div style="margin: 100px 85px;">
                    <asp:Label ID="lblNoItems" CssClass="noItems" runat="server" Text="There are no properties with first letter selected" />
                </div>
            </asp:Panel>
            <table width="100%">
                <tr>
                    <td width="68%">
                         <asp:DataPager ID="pagerBottom" runat="server" PagedControlID="lvFake">
                             <Fields>
                         <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False"
                              FirstPageText="<<" PreviousPageText="<" />
                         <asp:NumericPagerField />
                         <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False"
                              NextPageText=">" LastPageText=">>" />
                              </Fields>
                         </asp:DataPager>
                    </td>
                    <td >
                         <asp:Panel ID="pnlABC2" runat="server"></asp:Panel>
                    </td>
                </tr>
            </table>
           
                
                   
               
                    
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
